package data_structure;

public class leetcode_0941 {
    public boolean validMountainArray(int[] arr) {
        int len=arr.length;
        if(len<3) return false;
        int index=len-1;
        for(int i=0;i<len-1;++i){
            if(arr[i+1]==arr[i]) return false;
            if(arr[i+1]<arr[i]){
                index=i;
                break;
            }
        }
        if(index==len-1||index==0) return false;
        for(int i=index;i<len-1;++i){
            if(arr[i]<=arr[i+1]) return false;
        }
        return true;
    }
}
